from http.server import BaseHTTPRequestHandler, HTTPServer

# 创建HTTP服务器类
class HTTP1_0Server(BaseHTTPRequestHandler):
    def do_GET(self):
        # 将HTTP响应头部信息设置为200 OK
        self.send_response(200)

        # 设置HTTP响应内容类型为纯文本格式，字符集为UTF-8
        self.send_header('Content-type', 'text/plain; charset=utf-8')
        self.end_headers()

        # 设置返回的数据
        data = '谢勇,13223535189\n'
        data += '谭磊,18967853864\n'
        data += '孔丽,13596567113\n'
        data += '王磊,13562956057\n'
        data += '蔡霞,13548515865\n'
        data += '孙军,13240729977\n'
        data += '王勇,18922142264\n'
        data += '戴勇,13267133611\n'
        data += '苏军,18920943815\n'
        data += '雷洋,18952464416'

        # 发送数据到客户端
        self.wfile.write(bytes(data, 'utf-8'))

# 创建HTTP/1.0服务器对象
httpd = HTTPServer(('localhost', 8080), HTTP1_0Server)

# 启动HTTP/1.0服务器
httpd.serve_forever()
